from base import build_request, JsonHelper

"""
使用 base.build_request 直接请求 http
"""
token = "46c575222b62960bf8699eceae154d7c0239bf30ebda07be94901ec0"
url = "http://api.tushare.pro"
headers = {"Content-Type": "application/json"}
param = {
    "is_hs": "H",
    "list_status": "L",
    "exchange": "SSE"
}

data = {
    "api_name": "stock_basic",
    "token": token,
    "params": param,
    "fields": "ts_code,symbol,name,area,industry,fullname,enname,market,exchange,curr_type"
}

req = build_request(
    host=url,
    method="p"
)

resp = req.send(
    api_url="/",
    headers=headers,
    params=JsonHelper.convert_dict_to_json_str(data)
)

print(resp["json_string"])

"""
使用 scenario 请求接口
"""
